package com.example.demo3.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class UserController {
    //用于访问数据库的组件
    @Autowired
    JdbcTemplate jdbcTemplate;

    @RequestMapping("users")
    public Object userList() {
        List<Map<String, Object>> list = jdbcTemplate.queryForList("select * from user");
        return list;
    }

}
